package reverseStringPairs;

import java.util.Scanner;

public class ReverseStringPairs {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] allInputs = new String[100];

        System.out.println("请输入字符串序列并以*结束：");
        int length=0;
        while (true) {
            String input = scanner.nextLine();
            if ("*".equals(input)) {
                break;
            }
            allInputs[length]=input;
            length++;
        }
        scanner.close();

        for(int i=0;i<length;i++){
            StringBuilder sb=new StringBuilder(allInputs[i]);
            allInputs[i]=String.valueOf(sb.reverse());
        }

        System.out.println("逆序输出结果为：");
        //String result;
        for(int i = 0; i< (length/2); i++){
            System.out.print(allInputs[i*2+1]);
            System.out.print(allInputs[i*2]);
        }
        if(length%2!=0){
            System.out.println(allInputs[length-1]);
        }
    }
}